package com.cskaoyan.service;

import com.cskaoyan.bean.Footprint;
import com.cskaoyan.bean.FootprintExample;
import com.cskaoyan.mapper.FootprintMapper;
import com.cskaoyan.vo.FootprintVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: libugu@cskaoyan.com
 * @date 2021/4/9 - 18:55
 */
@Service
public class FootprintServiceImpl implements FootprintService {

    @Autowired
    FootprintMapper footprintMapper;
    @Override
    public FootprintVo qurey(Integer page, Integer limit, String sort, String order) {

        PageHelper.startPage(page,limit);

        FootprintExample footprintExample = new FootprintExample();
        List<Footprint> footprints = footprintMapper.selectByExample(footprintExample);

        PageInfo<Footprint> footprintPageInfo = new PageInfo<>();
        long total = footprintPageInfo.getTotal();

        FootprintVo footprintVo = new FootprintVo();
        footprintVo.setItems(footprints);
        footprintVo.setTotal(total);

        return footprintVo;

    }
}
